<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   Kaggle入门——使用scikit-learn解决DigitRecognition问题  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/16781.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466461426: Accept with keywords: (title(0.0):问题,社区,入门,数盟, topn(0.566666666667):社区,上官,入门,数盟,深度学习,分类器,行业资讯,分布,数据挖掘,数据分析,文件,结果,职业规划,准确率,基础架构,文章,参数,部分,函数,数据,python,样本,问题,算法,可视化,训练样本,编程语言,多项式,代码,分类).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    Kaggle入门——使用scikit-learn解决DigitRecognition问题
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    Kaggle入门——使用scikit-learn解决DigitRecognition问题 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,91] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/16781.html">
          Kaggle入门——使用scikit-learn解决DigitRecognition问题
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          2,464 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech" rel="category tag">
          文章
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <h2>
        1、scikit-learn简介
       </h2>
       <div>
       </div>
       <div>
        <p>
         scikit-learn是一个基于NumPy、SciPy、Matplotlib的开源机器学习工具包，采用Python语言编写，主要涵盖分类、
        </p>
        <p>
         回归和聚类等算法，例如knn、SVM、逻辑回归、朴素贝叶斯、随机森林、k-means等等诸多算法，官网上代码和文档
        </p>
        <p>
         都非常不错，对于机器学习开发者来说，是一个使用方便而强大的工具，节省不少开发时间。
        </p>
        <p>
         scikit-learn官网指南：
         <a href="http://scikit-learn.org/stable/user_guide.html" target="_blank">
          http://scikit-learn.org/stable/user_guide.html
         </a>
        </p>
       </div>
       <div>
       </div>
       <div>
        上一篇文章
        <a href="http://blog.csdn.net/u012162613/article/details/41929171" target="_blank">
         《大数据竞赛平台—Kaggle入门》
        </a>
        我分两部分内容介绍了Kaggle，在第二部分中，我记录了解决Kaggle上的竞赛项目DigitRecognition的整个过程，当时我是用自己写的kNN算法，尽管自己写歌kNN算法并不会花很多时间，但是当我们想尝试更多、更复杂的算法，如果每个算法都自己实现的话，会很浪费时间，这时候scikit-learn就发挥作用了，我们可以直接调用scikit-learn的算法包。当然，对于初学者来说，最好还是在理解了算法的基础上，来调用这些算法包，如果有时间，自己完整地实现一个算法相信会让你对算法掌握地更深入。
       </div>
       <div>
       </div>
       <div>
        OK，话休絮烦，下面进入第二部分。
       </div>
       <div>
       </div>
       <h2>
        <p name="t2">
        </p>
        2、使用scikit-learn解决DigitRecognition
       </h2>
       <div>
        我发现自己很喜欢用DigitRecognition这个问题来练习分类算法，因为足够简单。如果你还不知道DigitRecognition问题是什么，请先简单了解一下：
        <a href="https://www.kaggle.com/c/digit-recognizer" target="_blank">
         Kaggle DigitRecognition
        </a>
        ，在我上一篇文章中也有描述：
        <a href="http://blog.csdn.net/u012162613/article/details/41929171" target="_blank">
         《大数据竞赛平台—Kaggle入门》
        </a>
        。下面我使用scikit-learn中的算法包kNN（k近邻）、SVM（支持向量机）、NB（朴素贝叶斯）来解决这个问题，解决问题的关键步骤有两个：1、处理数据。2、调用算法。
       </div>
       <div>
       </div>
       <h3>
        <p name="t3">
        </p>
        （1）处理数据
       </h3>
       <div>
        这一部分与上一篇文章
        <a href="http://blog.csdn.net/u012162613/article/details/41929171" target="_blank">
         《大数据竞赛平台—Kaggle入门》
        </a>
        中第二部分的数据处理是一样的，本文不打算重复，下面只简单地罗列各个函数及其功能，在本文最后部分也有详细的代码。
       </div>
       <div>
       </div>
       <div>
        <div class="dp-highlighter bg_python">
         <div class="bar">
          <div class="tools">
           <b>
            [python]
           </b>
          </div>
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           <span class="keyword">
            def
           </span>
           loadTrainData():
          </li>
          <li class="">
           <span class="comment">
            #这个函数从train.csv文件中获取训练样本:trainData、trainLabel
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           loadTestData():
          </li>
          <li class="">
           <span class="comment">
            #这个函数从test.csv文件中获取测试样本:testData
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           toInt(array):
          </li>
          <li class="">
           <span class="keyword">
            def
           </span>
           nomalizing(array):
          </li>
          <li class="alt">
           <span class="comment">
            #这两个函数在loadTrainData()和loadTestData()中被调用
           </span>
          </li>
          <li class="">
           <span class="comment">
            #toInt()将字符串数组转化为整数，nomalizing()归一化整数
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           loadTestResult():
          </li>
          <li class="">
           <span class="comment">
            #这个函数加载测试样本的参考label，是为了后面的比较
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           saveResult(result,csvName):
          </li>
          <li class="">
           <span class="comment">
            #这个函数将result保存为csv文件，以csvName命名
           </span>
          </li>
         </ol>
        </div>
       </div>
       <div>
        <p>
         “处理数据”部分，我们从train.csv、test.csv文件中获取了训练样本的feature、训练样本的label、测试样本的feature，在程序中我们用trainData、trainLabel、testData表示。
        </p>
       </div>
       <div>
       </div>
       <h3>
        <p name="t4">
        </p>
        （2）调用scikit-learn中的算法
       </h3>
       <div>
        kNN算法
       </div>
       <div>
        <div class="dp-highlighter bg_python">
         <div class="bar">
          <div class="tools">
           <b>
            [python]
           </b>
           <p>
           </p>
           <div>
           </div>
          </div>
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           <span class="comment">
            #调用scikit的knn算法包
           </span>
          </li>
          <li class="">
           <span class="keyword">
            from
           </span>
           sklearn.neighbors
           <span class="keyword">
            import
           </span>
           KNeighborsClassifier
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           knnClassify(trainData,trainLabel,testData):
          </li>
          <li class="">
           knnClf=KNeighborsClassifier()
           <span class="comment">
            #default:k = 5,defined by yourself:KNeighborsClassifier(n_neighbors=10)
           </span>
          </li>
          <li class="alt">
           knnClf.fit(trainData,ravel(trainLabel))
          </li>
          <li class="">
           testLabel=knnClf.predict(testData)
          </li>
          <li class="alt">
           saveResult(testLabel,
           <span class="string">
            ‘sklearn_knn_Result.csv’
           </span>
           )
          </li>
          <li class="">
           <span class="keyword">
            return
           </span>
           testLabel
          </li>
         </ol>
        </div>
        <p>
         kNN算法包可以自己设定参数k，默认k=5，上面的comments有说明。
        </p>
       </div>
       <p>
        更加详细的使用，推荐上官网查看：
        <a href="http://scikit-learn.org/stable/modules/neighbors.html" target="_blank">
         http://scikit-learn.org/stable/modules/neighbors.html
        </a>
       </p>
       <div>
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
        SVM算法
       </div>
       <div>
        <div class="dp-highlighter bg_python">
         <div class="bar">
          <div class="tools">
           <b>
            [python]
           </b>
           <p>
           </p>
           <div>
           </div>
          </div>
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           <span class="comment">
            #调用scikit的SVM算法包
           </span>
          </li>
          <li class="">
           <span class="keyword">
            from
           </span>
           sklearn
           <span class="keyword">
            import
           </span>
           svm
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           svcClassify(trainData,trainLabel,testData):
          </li>
          <li class="">
           svcClf=svm.SVC(C=
           <span class="number">
            5.0
           </span>
           )
           <span class="comment">
            #default:C=1.0,kernel = ‘rbf’. you can try kernel:‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘precomputed’
           </span>
          </li>
          <li class="alt">
           svcClf.fit(trainData,ravel(trainLabel))
          </li>
          <li class="">
           testLabel=svcClf.predict(testData)
          </li>
          <li class="alt">
           saveResult(testLabel,
           <span class="string">
            ‘sklearn_SVC_C=5.0_Result.csv’
           </span>
           )
          </li>
          <li class="">
           <span class="keyword">
            return
           </span>
           testLabel
          </li>
         </ol>
        </div>
        <p>
         SVC()的参数有很多，核函数默认为’rbf’（径向基函数）,C默认为1.0
        </p>
       </div>
       <p>
        更加详细的使用，推荐上官网查看：
        <a href="http://scikit-learn.org/stable/modules/svm.html" target="_blank">
         http://scikit-learn.org/stable/modules/svm.html
        </a>
       </p>
       <div>
       </div>
       <div>
       </div>
       <div>
        朴素贝叶斯算法
       </div>
       <div>
        <div class="dp-highlighter bg_python">
         <div class="bar">
          <div class="tools">
           <b>
            [python]
           </b>
           <p>
           </p>
           <div>
           </div>
          </div>
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           <span class="comment">
            #调用scikit的朴素贝叶斯算法包,GaussianNB和MultinomialNB
           </span>
          </li>
          <li class="">
           <span class="keyword">
            from
           </span>
           sklearn.naive_bayes
           <span class="keyword">
            import
           </span>
           GaussianNB
           <span class="comment">
            #nb for 高斯分布的数据
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           GaussianNBClassify(trainData,trainLabel,testData):
          </li>
          <li class="">
           nbClf=GaussianNB()
          </li>
          <li class="alt">
           nbClf.fit(trainData,ravel(trainLabel))
          </li>
          <li class="">
           testLabel=nbClf.predict(testData)
          </li>
          <li class="alt">
           saveResult(testLabel,
           <span class="string">
            ‘sklearn_GaussianNB_Result.csv’
           </span>
           )
          </li>
          <li class="">
           <span class="keyword">
            return
           </span>
           testLabel
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="keyword">
            from
           </span>
           sklearn.naive_bayes
           <span class="keyword">
            import
           </span>
           MultinomialNB
           <span class="comment">
            #nb for 多项式分布的数据
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           MultinomialNBClassify(trainData,trainLabel,testData):
          </li>
          <li class="">
           nbClf=MultinomialNB(alpha=
           <span class="number">
            0.1
           </span>
           )
           <span class="comment">
            #default alpha=1.0,Setting alpha = 1 is called Laplace smoothing, while alpha &lt; 1 is called Lidstone smoothing.
           </span>
          </li>
          <li class="alt">
           nbClf.fit(trainData,ravel(trainLabel))
          </li>
          <li class="">
           testLabel=nbClf.predict(testData)
          </li>
          <li class="alt">
           saveResult(testLabel,
           <span class="string">
            ‘sklearn_MultinomialNB_alpha=0.1_Result.csv’
           </span>
           )
          </li>
          <li class="">
           <span class="keyword">
            return
           </span>
           testLabel
          </li>
         </ol>
        </div>
        <p>
         上面我尝试了两种朴素贝叶斯算法:高斯分布的和多项式分布的。多项式分布的函数有参数alpha可以自设定。
        </p>
       </div>
       <div>
        更加详细的使用，推荐上官网查看：
        <a href="http://scikit-learn.org/stable/modules/naive_bayes.html" target="_blank">
         http://scikit-learn.org/stable/modules/naive_bayes.html
        </a>
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
        <strong>
         使用方法总结：
        </strong>
       </div>
       <div>
        <strong>
        </strong>
       </div>
       <div>
        第一步：首先确定使用哪种分类器，这一步可以设置各种参数，比如:
       </div>
       <div>
        <div class="dp-highlighter bg_python">
         <div class="bar">
          <div class="tools">
           <b>
            [python]
           </b>
           <p>
           </p>
           <div>
           </div>
          </div>
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           svcClf=svm.SVC(C=
           <span class="number">
            5.0
           </span>
           )
          </li>
         </ol>
        </div>
       </div>
       <div>
        第二步：接这个分类器要使用哪些训练数据？调用fit方法，比如:
       </div>
       <div>
        <div class="dp-highlighter bg_python">
         <div class="bar">
          <div class="tools">
           <b>
            [python]
           </b>
           <p>
           </p>
           <div>
           </div>
          </div>
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           svcClf.fit(trainData,ravel(trainLabel))
          </li>
         </ol>
        </div>
        <p>
         <strong>
          fit(X,y)说明：
         </strong>
        </p>
       </div>
       <div>
        X:  对应trainData
       </div>
       <div>
        array-like, shape = [n_samples, n_features]，X是训练样本的特征向量集，n_samples行n_features列，即每个训练样本占一行，每个训练样本有多少特征就有多少列。
       </div>
       <div>
        y:  对应trainLabel
       </div>
       <div>
        array-like, shape = [n_samples]，y必须是一个行向量，这也是上面为什么使用numpy.ravel()函数的原因。
       </div>
       <div>
       </div>
       <div>
        第三步：使用分类器预测测试样本，比如：
       </div>
       <div>
        <div class="dp-highlighter bg_python">
         <div class="bar">
          <div class="tools">
           <b>
            [python]
           </b>
           <p>
           </p>
           <div>
           </div>
          </div>
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           testLabel=svcClf.predict(testData)
          </li>
         </ol>
        </div>
        <div>
        </div>
        <p>
         调用predict方法。
        </p>
       </div>
       <div>
       </div>
       <div>
        第四步：保存结果，这一步是取决于我们解决问题的要求，因为本文以DigitRecognition为例，所以有：
       </div>
       <div>
        <div class="dp-highlighter bg_python">
         <div class="bar">
          <div class="tools">
           <b>
            [python]
           </b>
          </div>
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           saveResult(testLabel,
           <span class="string">
            ‘sklearn_SVC_C=5.0_Result.csv’
           </span>
           )
          </li>
         </ol>
        </div>
        <h3>
         <p name="t5">
         </p>
         （3）make a submission
        </h3>
        <p>
         上面基本就是整个开发过程了，下面看一下各个算法的效果，在Kaggle上make a submission
        </p>
       </div>
       <div>
       </div>
       <div>
        knn算法的效果，准确率95.871%
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
        朴素贝叶斯，alpha=1.0，准确率81.043%
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
        SVM，linear核，准确率93.943%
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
       </div>
       <h2>
        <p name="t6">
        </p>
        3、工程文件
       </h2>
       <div>
        CSDN下载：
        <a href="http://download.csdn.net/download/u012162613/8268443" target="_blank">
         Kaggle 入门-使用scikit-learn解决DigitRecoginition
        </a>
       </div>
       <div>
       </div>
       <div>
        Github：
        <a href="https://github.com/wepe/Kaggle-Solution" target="_blank">
         https://github.com/wepe/Kaggle-Solution
        </a>
       </div>
       <div>
       </div>
       <div>
       </div>
       <div>
        贴一下代码：
       </div>
       <div>
        <div class="dp-highlighter bg_python">
         <div class="bar">
          <div class="tools">
           <b>
            [python]
           </b>
           <p>
           </p>
           <div>
           </div>
          </div>
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           <span class="comment">
            #!/usr/bin/python
           </span>
          </li>
          <li class="">
           <span class="comment">
            # -*- coding: utf-8 -*-
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            “””
           </span>
          </li>
          <li class="">
           <span class="comment">
            Created on Tue Dec 16 21:59:00 2014
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            @author: wepon
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            @blog:http://blog.csdn.net/u012162613
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            “””
           </span>
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="keyword">
            from
           </span>
           numpy
           <span class="keyword">
            import
           </span>
           *
          </li>
          <li class="">
           <span class="keyword">
            import
           </span>
           csv
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="keyword">
            def
           </span>
           toInt(array):
          </li>
          <li class="alt">
           array=mat(array)
          </li>
          <li class="">
           m,n=shape(array)
          </li>
          <li class="alt">
           newArray=zeros((m,n))
          </li>
          <li class="">
           <span class="keyword">
            for
           </span>
           i
           <span class="keyword">
            in
           </span>
           xrange(m):
          </li>
          <li class="alt">
           <span class="keyword">
            for
           </span>
           j
           <span class="keyword">
            in
           </span>
           xrange(n):
          </li>
          <li class="">
           newArray[i,j]=int(array[i,j])
          </li>
          <li class="alt">
           <span class="keyword">
            return
           </span>
           newArray
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           nomalizing(array):
          </li>
          <li class="">
           m,n=shape(array)
          </li>
          <li class="alt">
           <span class="keyword">
            for
           </span>
           i
           <span class="keyword">
            in
           </span>
           xrange(m):
          </li>
          <li class="">
           <span class="keyword">
            for
           </span>
           j
           <span class="keyword">
            in
           </span>
           xrange(n):
          </li>
          <li class="alt">
           <span class="keyword">
            if
           </span>
           array[i,j]!=
           <span class="number">
            0
           </span>
           :
          </li>
          <li class="">
           array[i,j]=
           <span class="number">
            1
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            return
           </span>
           array
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           loadTrainData():
          </li>
          <li class="">
           l=[]
          </li>
          <li class="alt">
           with open(
           <span class="string">
            ‘train.csv’
           </span>
           ) as file:
          </li>
          <li class="">
           lines=csv.reader(file)
          </li>
          <li class="alt">
           <span class="keyword">
            for
           </span>
           line
           <span class="keyword">
            in
           </span>
           lines:
          </li>
          <li class="">
           l.append(line)
           <span class="comment">
            #42001*785
           </span>
          </li>
          <li class="alt">
           l.remove(l[
           <span class="number">
            0
           </span>
           ])
          </li>
          <li class="">
           l=array(l)
          </li>
          <li class="alt">
           label=l[:,
           <span class="number">
            0
           </span>
           ]
          </li>
          <li class="">
           data=l[:,
           <span class="number">
            1
           </span>
           :]
          </li>
          <li class="alt">
           <span class="keyword">
            return
           </span>
           nomalizing(toInt(data)),toInt(label)
           <span class="comment">
            #label 1*42000  data 42000*784
           </span>
          </li>
          <li class="">
           <span class="comment">
            #return trainData,trainLabel
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="keyword">
            def
           </span>
           loadTestData():
          </li>
          <li class="alt">
           l=[]
          </li>
          <li class="">
           with open(
           <span class="string">
            ‘test.csv’
           </span>
           ) as file:
          </li>
          <li class="alt">
           lines=csv.reader(file)
          </li>
          <li class="">
           <span class="keyword">
            for
           </span>
           line
           <span class="keyword">
            in
           </span>
           lines:
          </li>
          <li class="alt">
           l.append(line)
           <span class="comment">
            #28001*784
           </span>
          </li>
          <li class="">
           l.remove(l[
           <span class="number">
            0
           </span>
           ])
          </li>
          <li class="alt">
           data=array(l)
          </li>
          <li class="">
           <span class="keyword">
            return
           </span>
           nomalizing(toInt(data))
           <span class="comment">
            #  data 28000*784
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            #return testData
           </span>
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           loadTestResult():
          </li>
          <li class="">
           l=[]
          </li>
          <li class="alt">
           with open(
           <span class="string">
            ‘knn_benchmark.csv’
           </span>
           ) as file:
          </li>
          <li class="">
           lines=csv.reader(file)
          </li>
          <li class="alt">
           <span class="keyword">
            for
           </span>
           line
           <span class="keyword">
            in
           </span>
           lines:
          </li>
          <li class="">
           l.append(line)
           <span class="comment">
            #28001*2
           </span>
          </li>
          <li class="alt">
           l.remove(l[
           <span class="number">
            0
           </span>
           ])
          </li>
          <li class="">
           label=array(l)
          </li>
          <li class="alt">
           <span class="keyword">
            return
           </span>
           toInt(label[:,
           <span class="number">
            1
           </span>
           ])
           <span class="comment">
            #  label 28000*1
           </span>
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            #result是结果列表
           </span>
          </li>
          <li class="">
           <span class="comment">
            #csvName是存放结果的csv文件名
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           saveResult(result,csvName):
          </li>
          <li class="">
           with open(csvName,
           <span class="string">
            ‘wb’
           </span>
           ) as myFile:
          </li>
          <li class="alt">
           myWriter=csv.writer(myFile)
          </li>
          <li class="">
           <span class="keyword">
            for
           </span>
           i
           <span class="keyword">
            in
           </span>
           result:
          </li>
          <li class="alt">
           tmp=[]
          </li>
          <li class="">
           tmp.append(i)
          </li>
          <li class="alt">
           myWriter.writerow(tmp)
          </li>
          <li class="">
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            #调用scikit的knn算法包
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            from
           </span>
           sklearn.neighbors
           <span class="keyword">
            import
           </span>
           KNeighborsClassifier
          </li>
          <li class="">
           <span class="keyword">
            def
           </span>
           knnClassify(trainData,trainLabel,testData):
          </li>
          <li class="alt">
           knnClf=KNeighborsClassifier()
           <span class="comment">
            #default:k = 5,defined by yourself:KNeighborsClassifier(n_neighbors=10)
           </span>
          </li>
          <li class="">
           knnClf.fit(trainData,ravel(trainLabel))
          </li>
          <li class="alt">
           testLabel=knnClf.predict(testData)
          </li>
          <li class="">
           saveResult(testLabel,
           <span class="string">
            ‘sklearn_knn_Result.csv’
           </span>
           )
          </li>
          <li class="alt">
           <span class="keyword">
            return
           </span>
           testLabel
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            #调用scikit的SVM算法包
           </span>
          </li>
          <li class="">
           <span class="keyword">
            from
           </span>
           sklearn
           <span class="keyword">
            import
           </span>
           svm
          </li>
          <li class="alt">
           <span class="keyword">
            def
           </span>
           svcClassify(trainData,trainLabel,testData):
          </li>
          <li class="">
           svcClf=svm.SVC(C=
           <span class="number">
            5.0
           </span>
           )
           <span class="comment">
            #default:C=1.0,kernel = ‘rbf’. you can try kernel:‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘precomputed’
           </span>
          </li>
          <li class="alt">
           svcClf.fit(trainData,ravel(trainLabel))
          </li>
          <li class="">
           testLabel=svcClf.predict(testData)
          </li>
          <li class="alt">
           saveResult(testLabel,
           <span class="string">
            ‘sklearn_SVC_C=5.0_Result.csv’
           </span>
           )
          </li>
          <li class="">
           <span class="keyword">
            return
           </span>
           testLabel
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            #调用scikit的朴素贝叶斯算法包,GaussianNB和MultinomialNB
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            from
           </span>
           sklearn.naive_bayes
           <span class="keyword">
            import
           </span>
           GaussianNB
           <span class="comment">
            #nb for 高斯分布的数据
           </span>
          </li>
          <li class="">
           <span class="keyword">
            def
           </span>
           GaussianNBClassify(trainData,trainLabel,testData):
          </li>
          <li class="alt">
           nbClf=GaussianNB()
          </li>
          <li class="">
           nbClf.fit(trainData,ravel(trainLabel))
          </li>
          <li class="alt">
           testLabel=nbClf.predict(testData)
          </li>
          <li class="">
           saveResult(testLabel,
           <span class="string">
            ‘sklearn_GaussianNB_Result.csv’
           </span>
           )
          </li>
          <li class="alt">
           <span class="keyword">
            return
           </span>
           testLabel
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="keyword">
            from
           </span>
           sklearn.naive_bayes
           <span class="keyword">
            import
           </span>
           MultinomialNB
           <span class="comment">
            #nb for 多项式分布的数据
           </span>
          </li>
          <li class="">
           <span class="keyword">
            def
           </span>
           MultinomialNBClassify(trainData,trainLabel,testData):
          </li>
          <li class="alt">
           nbClf=MultinomialNB(alpha=
           <span class="number">
            0.1
           </span>
           )
           <span class="comment">
            #default alpha=1.0,Setting alpha = 1 is called Laplace smoothing, while alpha &lt; 1 is called Lidstone smoothing.
           </span>
          </li>
          <li class="">
           nbClf.fit(trainData,ravel(trainLabel))
          </li>
          <li class="alt">
           testLabel=nbClf.predict(testData)
          </li>
          <li class="">
           saveResult(testLabel,
           <span class="string">
            ‘sklearn_MultinomialNB_alpha=0.1_Result.csv’
           </span>
           )
          </li>
          <li class="alt">
           <span class="keyword">
            return
           </span>
           testLabel
          </li>
          <li class="">
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="keyword">
            def
           </span>
           digitRecognition():
          </li>
          <li class="alt">
           trainData,trainLabel=loadTrainData()
          </li>
          <li class="">
           testData=loadTestData()
          </li>
          <li class="alt">
           <span class="comment">
            #使用不同算法
           </span>
          </li>
          <li class="">
           result1=knnClassify(trainData,trainLabel,testData)
          </li>
          <li class="alt">
           result2=svcClassify(trainData,trainLabel,testData)
          </li>
          <li class="">
           result3=GaussianNBClassify(trainData,trainLabel,testData)
          </li>
          <li class="alt">
           result4=MultinomialNBClassify(trainData,trainLabel,testData)
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            #将结果与跟给定的knn_benchmark对比,以result1为例
           </span>
          </li>
          <li class="">
           resultGiven=loadTestResult()
          </li>
          <li class="alt">
           m,n=shape(testData)
          </li>
          <li class="">
           different=
           <span class="number">
            0
           </span>
           <span class="comment">
            #result1中与benchmark不同的label个数，初始化为0
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            for
           </span>
           i
           <span class="keyword">
            in
           </span>
           xrange(m):
          </li>
          <li class="">
           <span class="keyword">
            if
           </span>
           result1[i]!=resultGiven[
           <span class="number">
            0
           </span>
           ,i]:
          </li>
          <li class="alt">
           different+=
           <span class="number">
            1
           </span>
          </li>
          <li class="">
           <span class="keyword">
            print
           </span>
           different
          </li>
         </ol>
        </div>
       </div>
       <blockquote>
        <p>
         作者：wepon
        </p>
        <p>
         文章出处:
         <a href="http://blog.csdn.net/u012162613" target="_blank">
          http://blog.csdn.net/u012162613
         </a>
        </p>
       </blockquote>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/24220.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/05/100910rrxp5plglxk4lcle-291x200.png"/>
        </a>
        <a class="link" href="http://dataunion.org/24220.html" rel="bookmark" title="520大数据：八成男性期待被表白 “套路”也是爱">
         520大数据：八成男性期待被表白 “套路”也是爱
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/23785.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/04/u7145986293872240263fm21gp0-298x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/23785.html" rel="bookmark" title="Docker安全基准：22项新增要点概述">
         Docker安全基准：22项新增要点概述
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/23703.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/04/1317020-300x163.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/23703.html" rel="bookmark" title="推荐：五个不容错过的数据科学家博客">
         推荐：五个不容错过的数据科学家博客
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/23507.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/110606wjpugdldig4idddn.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/23507.html" rel="bookmark" title="解密深度学习在智能推荐系统的实践与应用">
         解密深度学习在智能推荐系统的实践与应用
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F16781.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/16781.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/16781.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>